package edu.qqcui.study.bean;

import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

/**
 * TODO
 *
 * @author cuiqingqiang
 * @version 1.0
 * @date 2021-06-26 15:33
 **/
@Component
public class Cat implements InitializingBean, DisposableBean {
	public Cat() {
		System.out.println("Cat constructor");
	}
	/**
	 * Invoked by the containing {@code BeanFactory} on destruction of a bean.
	 *
	 * @throws Exception in case of shutdown errors. Exceptions will get logged
	 *                   but not rethrown to allow other beans to release their resources as well.
	 */
	@Override
	public void destroy() throws Exception {
		System.out.println("Cat destroy");
	}

	/**
	 * Invoked by the containing {@code BeanFactory} after it has set all bean properties
	 * and satisfied {@link BeanFactoryAware}, {@code ApplicationContextAware} etc.
	 * <p>This method allows the bean instance to perform validation of its overall
	 * configuration and final initialization when all bean properties have been set.
	 *
	 * @throws Exception in the event of misconfiguration (such as failure to set an
	 *                   essential property) or if initialization fails for any other reason
	 */
	@Override
	public void afterPropertiesSet() throws Exception {
		System.out.println("Cat afterPropertiesSet");
	}
}
